<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org"
	xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout">
<head>
<meta charset="UTF-8">
<title>调整房间</title>
<link rel="stylesheet" href="css/bootstrap.css">
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/new2.css">

<script type="text/javascript" src="layer/jquery.min.js"></script>
<script src="layer/layer.js"></script>
<script type="text/javascript">
	$(function() {

		//复选框只能选中一个
		var roomModelhouses = $(".roomModelhouses");
		roomModelhouses.click(function() {
			if (this.checked || this.checked == 'checked') {
				roomModelhouses.removeAttr("checked");
				//这里需注意jquery1.6以后必须用prop()方法
				//$(this).attr("checked",true);
				$(this).prop("checked", true);
			}
		});

		//复选框只能选中一个
		var roomAncillaryproperty = $(".roomAncillaryproperty");
		roomAncillaryproperty.click(function() {
			if (this.checked || this.checked == 'checked') {
				roomAncillaryproperty.removeAttr("checked");
				//这里需注意jquery1.6以后必须用prop()方法
				//$(this).attr("checked",true);
				$(this).prop("checked", true);
			}
		});
		//添加成功或者失败
		/* var ex = $("input[name=ex]").val();
		alert(ex);
		if (null != ex && '' != ex) {
			alert(ex);
		} */
	});
</script>
</head>
<body>
	<div class="container">
		<div class="align-center">
			<form class="form-horizontal" id="updateRoom"
				th:action="@{/upByRoomId}" th:method="post" th:object="${room}">
				<!-- <input th:value="${ex}" name="ex" type="hidden"> -->
				<!--11111111111111111111111-->
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group form-group-sm">
							<label class="col-xs-4 control-label"><span>房间</span></label>
							<div class="col-xs-8">
								<input class="form-control input-sm" th:field="*{room_name}"
									type="text" placeholder="" th:value="${room.room_name}" />
								<!-- <input th:field="*{roomNumber}"  type="hidden"  th:value="${room.roomNumber}" />房间号
                            <input th:field="*{ban_name}"  type="hidden"  th:value="${room.ban_name}" />楼栋
                            <input th:field="*{det_abbreviation}"  type="hidden"  th:value="${room.det_abbreviation}" />简称
                            <input th:field="*{project_name}"  type="hidden"  th:value="${room.project_name}" />项目名称 -->
								<input th:field="*{roomId}" type="hidden"
									th:value="${room.roomId}" />
							</div>
						</div>
					</div>

					<div class="col-xs-6">
						<div class="form-group form-group-sm">
							<label class="col-xs-4 control-label">销售状态</label>
							<div class="col-xs-8">
								<input class="form-control input-sm" type="text" placeholder=""
									th:field="*{roomSalesstatus}"
									th:value="${room.roomSalesstatus}">
							</div>
						</div>
					</div>
				</div>

				<!--2222222222222222222222-->
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group form-group-sm">
							<label class="col-xs-4 control-label"><span class="sb">户型</span></label>
							<div class="col-xs-8">
								<select class="form-control input-sm"
									th:field="*{roomHousetypeid}">
									<!-- 循环 -->
									<th:block th:each="housetype : ${housetypes}">
										<th:block th:if="${room.hou_name} eq ${housetype.houName}">
											<!-- 11111111222 -->
											<option th:value="${housetype.houId}" selected="selected"
												th:text="${housetype.houName}">b</option>
										</th:block>
										<th:block th:if="${room.hou_name} != ${housetype.houName}  ">
											<option th:value="${housetype.houId}"
												th:text="${housetype.houName}">b</option>
										</th:block>
									</th:block>
								</select>
							</div>
						</div>
					</div>

					<div class="col-xs-6">
						<div class="form-group form-group-sm">
							<label class="col-xs-4 control-label">房间结构</label>
							<div class="col-xs-8">
								<input class="form-control input-sm" th:field="*{roomStructure}"
									type="text" placeholder="" th:value="${room.roomStructure}">
							</div>
						</div>
					</div>
				</div>


				<!--333333333333333-->
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group form-group-sm">
							<label class="col-xs-4 control-label">景观</label>
							<div class="col-xs-8">
								<select class="form-control input-sm" th:field="*{roomScenery}">
									<!-- 循环 -->
									<th:block th:each="roomScenery : ${array.roomScenerys}">
										<!-- 如果相等，默认选中 -->
										<th:block th:if="${roomScenery} eq ${room.roomScenery}">
											<option th:value="${roomScenery}" th:text="${roomScenery}"
												selected="selected">b</option>
										</th:block>
										<!-- 正常循环下拉列表 -->
										<th:block th:if="${roomScenery} != ${room.roomScenery}">
											<option th:value="${roomScenery}" th:text="${roomScenery}">b</option>
										</th:block>
									</th:block>
								</select>
							</div>
						</div>
					</div>

					<div class="col-xs-6">
						<div class="form-group form-group-sm">
							<label class="col-xs-4 control-label">朝向</label>
							<div class="col-xs-8">
								<select class="form-control input-sm"
									th:field="*{roomOrientation}">
									<!-- 循环 -->
									<th:block th:each="roomOrientation : ${array.roomOrientations}">
										<!-- 如果相等，默认选中 -->
										<th:block
											th:if="${roomOrientation} eq ${room.roomOrientation}">
											<option th:value="${roomOrientation}"
												th:text="${roomOrientation}" selected="selected">b</option>
										</th:block>
										<!-- 正常循环下拉列表 -->
										<th:block
											th:if="${roomOrientation} != ${room.roomOrientation}">
											<option th:value="${roomOrientation}"
												th:text="${roomOrientation}">b</option>
										</th:block>
									</th:block>
								</select>
							</div>
						</div>
					</div>
				</div>


				<!--666666-->
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group form-group-sm">
							<label class="col-xs-4 control-label"><span class="sb">建筑面积</span></label>
							<div class="col-xs-8">
								<input class="form-control input-sm" placeholder=""
									th:field="*{roomCoveredArea}"
									th:value="${#numbers.formatDecimal(room.roomCoveredArea,0,3,'COMMA')}">
							</div>
						</div>
					</div>

					<div class="col-xs-6">
						<div class="form-group form-group-sm">
							<label class="col-xs-4 control-label"><span class="sb">套内面积</span></label>
							<div class="col-xs-8">
								<input class="form-control input-sm" placeholder=""
									th:field="*{roomInnerArea}"
									th:value="${#numbers.formatDecimal(room.roomInnerArea,0,3,'COMMA')}">
							</div>
						</div>
					</div>
				</div>


				<!--777777-->
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group form-group-sm">
							<label class="col-xs-4 control-label"><span>面积状态</span></label>
							<div class="col-xs-8">
								<input class="form-control input-sm" placeholder=""
									th:field="*{roomAreastate}" th:value="${room.roomAreastate}">
							</div>
						</div>
					</div>

					<div class="col-xs-6">
						<div class="form-group form-group-sm">
							<label class="col-xs-4 control-label"><span class="sb">产品类型</span></label>
							<div class="col-xs-8">
								<input class="form-control input-sm" placeholder=""
									th:field="*{roomProducttype}"
									th:value="${room.roomProducttype}">
							</div>
						</div>
					</div>
				</div>


				<!--8888888-->
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group form-group-sm">
							<label class="col-xs-4 control-label"><span class="sb">计价方式</span></label>
							<div class="col-xs-8">
								<select class="form-control input-sm"
									th:field="*{roomValuationmethod}" disabled="disabled">
									<!-- 循环 -->
									<th:block
										th:each="roomValuationmethod : ${array.roomValuationmethods}">
										<!-- 如果相等，默认选中 -->
										<th:block
											th:if="${roomValuationmethod} eq ${room.roomValuationmethod}">
											<option th:value="${roomValuationmethod}"
												th:text="${roomValuationmethod}" selected="selected">b</option>
										</th:block>
										<!-- 正常循环下拉列表 -->
										<th:block
											th:if="${roomValuationmethod} != ${room.roomValuationmethod}">
											<option th:value="${roomValuationmethod}"
												th:text="${roomValuationmethod}">b</option>
										</th:block>
									</th:block>
								</select>
							</div>
						</div>
					</div>

					<div class="col-xs-6">
						<div class="form-group form-group-sm">
							<label class="col-xs-4 control-label">装修标准</label>
							<div class="col-xs-8">
								<input class="form-control input-sm" placeholder=""
									th:field="*{roomDecorationstandard}"
									th:value="${room.roomDecorationstandard}">
							</div>
						</div>
					</div>
				</div>



				<!--99999-->
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group form-group-sm">
							<label class="col-xs-4 control-label"><span class="sb">装修单价</span></label>
							<div class="col-xs-8">
								<input class="form-control input-sm" placeholder=""
									th:field="*{roomDecorationunitprice}"
									th:value="${#numbers.formatDecimal(room.roomDecorationunitprice,0,2,'COMMA')}">
							</div>
						</div>
					</div>

					<div class="col-xs-6">
						<div class="form-group form-group-sm">
							<label class="col-xs-4 control-label">装修款</label>
							<div class="col-xs-8">
								<input class="form-control input-sm" placeholder=""
									th:field="*{roomDecorationmoney}"
									th:value="${#numbers.formatDecimal(room.roomDecorationmoney,0,2,'COMMA')}">
							</div>
						</div>
					</div>
				</div>

				<!--101010101010101-->

				<div class="row">
					<div class="col-xs-6">
						<div class="form-group form-group-sm">
							<label class="col-xs-4 control-label"><span class="sb">是否样板房</span></label>
							<div class="col-xs-8">
								<div class="checkbox">
									<!-- 1'是'选中，2'否'选中 -->
									<th:block th:if="${room.roomModelhouses} eq 1">
										<label><input type="checkbox" class="roomModelhouses"
											checked="checked" th:field="*{roomModelhouses}" value="1">
											是</label>
										<label><input type="checkbox" class="roomModelhouses"
											th:field="*{roomModelhouses}" value="2"> 否</label>
									</th:block>
									<th:block th:if="${room.roomModelhouses} eq 2">
										<label><input type="checkbox" class="roomModelhouses"
											th:field="*{roomModelhouses}" value="1"> 是</label>
										<label><input type="checkbox" class="roomModelhouses"
											checked="checked" th:field="*{roomModelhouses}" value="2">
											否</label>
									</th:block>
								</div>

							</div>
						</div>
					</div>

					<div class="col-xs-6">
						<div class="form-group form-group-sm">
							<label class="col-xs-4 control-label">是否附属房产</label>
							<div class="col-xs-8">
								<div class="checkbox">
									<!-- 1是选中，2否选中 -->
									<th:block th:if="${room.roomAncillaryproperty} eq 1">
										<label><input type="checkbox"
											class="roomAncillaryproperty" checked="checked"
											th:field="*{roomAncillaryproperty}" value="1"> 是</label>
										<label><input type="checkbox"
											class="roomAncillaryproperty"
											th:field="*{roomAncillaryproperty}" value="2"> 否</label>
									</th:block>
									<th:block th:if="${room.roomAncillaryproperty} eq 2">
										<label><input type="checkbox"
											class="roomAncillaryproperty"
											th:field="*{roomAncillaryproperty}" value="1"> 是</label>
										<label><input type="checkbox"
											class="roomAncillaryproperty" checked="checked"
											th:field="*{roomAncillaryproperty}" value="2"> 否</label>
									</th:block>
								</div>

							</div>
						</div>
					</div>
				</div>

				<!--1111111111111-->
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group form-group-sm">
							<label class="col-xs-4 control-label"><span class="sb">建筑单价</span></label>
							<div class="col-xs-8">
								<input class="form-control input-sm" type="text" placeholder=""
									th:field="*{roomBuildingUnitPrice}"
									th:value="${#numbers.formatDecimal(room.roomBuildingUnitPrice,0,2,'COMMA')}">
							</div>
						</div>
					</div>

					<div class="col-xs-6">
						<div class="form-group form-group-sm">
							<label class="col-xs-4 control-label"><span class="sb">套内单价</span></label>
							<div class="col-xs-8">
								<input class="form-control input-sm" placeholder=""
									th:field="*{roomInternalUnitPrice}"
									th:value="${#numbers.formatDecimal(room.roomInternalUnitPrice,0,2,'COMMA')}">
							</div>
						</div>
					</div>
				</div>
				<!--12-->
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group form-group-sm">
							<label class="col-xs-4 control-label">标准总价 </label>
							<div class="col-xs-8">
								<input class="form-control input-sm" type="text" placeholder=""
									th:field="*{roomStandardtotalprice}"
									th:value="${#numbers.formatDecimal(room.roomStandardtotalprice,0,2,'COMMA')}">
							</div>
						</div>
					</div>

					<div class="col-xs-6">
						<div class="form-group form-group-sm">
							<label class="col-xs-4 control-label"><span class="sb">租售类型</span></label>
							<div class="col-xs-8">

								<select class="form-control input-sm"
									th:field="*{roomLeasetype}" disabled="disabled">
									<!-- 循环 -->
									<th:block th:each="roomLeasetype : ${array.roomLeasetypes}">
										<!-- 如果相等，默认选中 -->
										<th:block th:if="${roomLeasetype} eq ${room.roomLeasetype}">
											<option th:value="${roomLeasetype}"
												th:text="${roomLeasetype}" selected="selected">b</option>
										</th:block>
										<!-- 正常循环下拉列表 -->
										<th:block th:if="${roomLeasetype} != ${room.roomLeasetype}">
											<option th:value="${roomLeasetype}"
												th:text="${roomLeasetype}">b</option>
										</th:block>
									</th:block>
								</select>
							</div>
						</div>
					</div>
				</div>
				<!--13-->
				<div class="row">
					<div class="col-xs-12">
						<div class="form-group form-group-sm">
							<label class="col-xs-2 control-label">户型点评</label>
							<div class="col-xs-10">
								<textarea class="form-control" rows="3"
									th:field="*{roomHousetypereview}"
									th:text="${room.roomHousetypereview}"></textarea>
							</div>
						</div>
					</div>
				</div>

				<div class="form-group">
					<div class="col-sm-offset-11 col-sm-1">
						<button type="button" class="btn btn-default" onclick="updateRoom();">保存</button>
					</div>
				</div>
			</form>
		</div>
	</div>
	<script type="text/javascript">
		function updateRoom(){
			debugger;
			var formData = new FormData($("#updateRoom")[0]);
			$.ajax({
				type : "POST",
	 			url : "/upByRoomId",
	 			clearForm : true,
	 			data : formData,
	 			contentType : false,
	 			processData : false,
	 			async : false,
	 			dataType : "json",
	 			success : function(data) {
	 				debugger;
	 				if (data.num == true ) {
	 					debugger;
	 					alert("修改成功!");
	 					layer.close(layer.index);  
	 			        window.parent.location.reload();
	 					
	 				} else if(data.num == false ){
	 					debugger;
	 					alert("修改失败!");
	 				}
	 			}
			});
		};
	</script>
</body>
</html>